package com.zhuss.controller.meeting;

import com.zhuss.bean.bo.meeting.apply.DetailApplyBo;
import com.zhuss.bean.bo.meeting.apply.SearchApplyBo;
import com.zhuss.bean.bo.meeting.apply.SearchCheckBo;
import com.zhuss.bean.bo.meeting.room.GetSituationBo;
import com.zhuss.common.AbstractBo;
import com.zhuss.common.BaseController;
import com.zhuss.common.ReadService;
import com.zhuss.exception.WpsException;
import com.zhuss.meeting.apply.ApplyReadServiceExt;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * 会议室新增 controller
 * @Author: zhushanshuo
 * @Date: 2020/2/12 18:18
 */
@RestController
@RequestMapping("/apply")
public class ApplyReadController extends BaseController{

    @Autowired
    @Qualifier("applyReadService")
    private ReadService<Object, Object> applyReadService;

    @Autowired
    @Qualifier("applyReadServiceExt")
    private ApplyReadServiceExt applyReadServiceExt;

    /**
     * 会议室申请列表
     * @throws WpsException
     */
    @ResponseBody
    @RequestMapping("/list")
    public Object list(@RequestBody SearchApplyBo bo) throws WpsException {
        Object result = applyReadService.list(bo);
        return result;
    }

    /**
     * 详情
     * @param bo
     * @throws WpsException
     */
    @ResponseBody
    @RequestMapping("/detail")
    public Object detail(@RequestBody DetailApplyBo bo) throws WpsException {
        Object result = applyReadService.detail(bo);
        return result;
    }

    /**
     * 会议室待审批列表
     * @throws WpsException
     */
    @ResponseBody
    @RequestMapping("/listCheck")
    public Object listCheck(@RequestBody SearchCheckBo bo) throws WpsException {
        Object result = applyReadServiceExt.listCheck(bo);
        return result;
    }

    /**
     * 会议室已审批列表
     * @throws WpsException
     */
    @ResponseBody
    @RequestMapping("/listApproved")
    public Object listApproved(@RequestBody SearchCheckBo bo) throws WpsException {
        Object result = applyReadServiceExt.listApproved(bo);
        return result;
    }

    /**
     * 获取会议室百分比
     * @param bo
     * @return
     * @throws WpsException
     */
    @ResponseBody
    @RequestMapping("/getRoomPercentage")
    public Object getRoomPercentage(@RequestBody AbstractBo bo) throws WpsException {
        return applyReadServiceExt.getRoomPercentage(bo);
    }

    /**
     * 获取会议室状态
     * @param bo
     * @return
     * @throws WpsException
     */
    @ResponseBody
    @RequestMapping("/getRoomStatus")
    public Object getRoomStatus(@RequestBody GetSituationBo bo) throws WpsException {
        return applyReadServiceExt.getRoomStatus(bo);
    }
}
